home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.5 KB | 154 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWAbout.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- // The about box code is temporary. Only works on the Mac. All the resource
- // have to be in the part with very specific ids.
- //
- // case kODCommandAbout:
- // {
- // FW_CAcquireCFMResourceAccess a;
- // About();
- // }
- // break;
-
- #include "FWFrameW.hpp"
-
- #ifndef FWABOUT_H
- #include "FWAbout.h"
- #endif
-
- #ifndef FWCFMRES_H
- #include "FWCFMRes.h"
- #endif
-
- // ----- Macintosh Includes -----
-
- #if defined(FW_BUILD_MAC) && !defined(__OSUTILS__)
- #include <OSUtils.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__TOOLUTILS__)
- #include <ToolUtils.h>
- #endif
-
- #if defined(FW_BUILD_MAC) && !defined(__DIALOGS__)
- #include <Dialogs.h>
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FWFrameworkAbout
- #endif
-
- //========================================================================================
- // Globales
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
-
- #define kDialogID 300
-
- //========================================================================================
- // FW_MacAlertDialogFilter
- //========================================================================================
-
- static pascal Boolean FW_MacAlertDialogFilter(DialogPtr theDialog,
- EventRecord * theEvent,
- short *itemHit)
- {
- Boolean result = FALSE;
-
- switch (theEvent->what)
- {
- case keyDown:
- case autoKey:
- {
- switch (theEvent->message & charCodeMask)
- {
- case 0x0D:
- case 0x03:
- case 0x1B:
- result = TRUE;
- *itemHit = 1;
- break;
- }
-
- if (result) // flash the button
- {
- long theTick;
- short itemType;
- Handle hItem;
- Rect box;
-
- ::GetDialogItem(theDialog, *itemHit, &itemType, &hItem, &box);
- ::HiliteControl((ControlHandle)hItem, 1);
- ::Delay(6,&theTick);
- ::HiliteControl((ControlHandle)hItem, 0);
- }
- }
- break;
-
- case updateEvt:
- if (theDialog == (DialogPtr)theEvent->message)
- {
- PenState ps;
- Rect box;
- Handle handle;
- short type;
-
- ::SetPort(theDialog);
- ::GetPenState(&ps);
- ::PenSize(3, 3);
- ::GetDialogItem(theDialog, 1, &type, &handle, &box);
- ::InsetRect(&box, -4, -4);
- ::FrameRoundRect(&box, 16, 16);
- ::SetPenState(&ps);
- }
- break;
- }
-
- return result;
- }
- #endif
-
- //----------------------------------------------------------------------------------------
- // FW_About
- //----------------------------------------------------------------------------------------
-
- void FW_About(FW_Instance partInstance)
- {
- FW_CAcquireCFMResourceAccess a(partInstance);
-
- #ifdef FW_BUILD_MAC
- DialogPtr dlg = ::GetNewDialog(kDialogID, NULL, WindowPtr(-1));
- ::ShowWindow(dlg);
-
- short item;
- ModalFilterUPP filterProc = NewModalFilterProc(&FW_MacAlertDialogFilter);
- do
- {
- ::ModalDialog(filterProc, &item);
- } while (item != 1);
- DisposeRoutineDescriptor(filterProc);
-
- ::DisposeDialog(dlg);
- #endif
-
- #ifdef FW_BUILD_WIN
- // [HLX] Windows code go here
- #endif
- }
-